#include "Utils.h"

std::wstring stdString2wString(const std::string& str)
{
	/*int len;
	int slength = (int)s.length() + 1;
	len = MultiByteToWideChar(CP_ACP, 0, s.c_str(), slength, 0, 0);
	wchar_t* buf = new wchar_t[len];
	MultiByteToWideChar(CP_ACP, 0, s.c_str(), slength, buf, len);
	std::wstring r(buf);
	delete[] buf;
	return r;*/
	std::wstring str2(str.length(), L' '); // Make room for characters
  
     // Copy string to wstring.
     std::copy(str.begin(), str.end(), str2.begin());
	return str2;
}

void WindowsToDirectXCoord(RECT* viewport, int winX, int winY, float& dx, float& dy)
{
	int width = viewport->right - viewport->left;
	int height= viewport->bottom - viewport->top;

	winY = height - winY;
	dx = winX * (2.0f / width) - 1.0f;
	dy = winY * (2.0f / height) - 1.0f;
}